﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace peonwar
{
    static class GameSound
    {
        // ---PROPERTIES---
        // Tableaux pour stocker les sons de chaque peon
        // Un tableau par Unit contenant, pour l'instant, 3 sons : son de pop, de mort et de tir
        // tableau a double entrée [ UnitType, type de son ]

        static public SoundEffect[,] UnitSound;
        static public SoundEffect[] Explosions;

        // Sons divers
        static public SoundEffect cashSound;
        static public SoundEffect noCashSound;
        static public SoundEffect baseUpSound;

        // Musiques
        // static public MediaLibrary library = new MediaLibrary();
        // static public SongCollection songs = library.Songs;
        static public Song MenuMusic;
        static public Song[] LevelMusic; // Juste en attendant ... Pour preparer la transition entre music

        //Son UI
        static public SoundEffect ButtonClick;
        static public SoundEffect ButtonTouche;
        static public SoundEffect AchievLocked;
        static public SoundEffect Ting;
        static public SoundEffect Scream;

        //Quake
        static public SoundEffect[] QuakeSounds;


        //Pouvoirs 
        static public SoundEffect[] SoundPouvoirs;

        // ---METHODES---
        // Charge tout les sons
        static public void LoadContent(ContentManager content)
        {
            SoundEffect.MasterVolume = SettingManager.CurrentProfil.SoundVol/10;

            UnitSound = new SoundEffect[,] {
                 // UnitLight1
                 {
                 content.Load<SoundEffect>("Sons/UnitLight1/UnitLight1_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitLight1/UnitLight1_Die"), 
                 content.Load<SoundEffect>("Sons/UnitLight1/UnitLight1_Fire")
                 },
                 // UnitLight2
                 { 
                 content.Load<SoundEffect>("Sons/UnitLight2/UnitLight2_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitLight2/UnitLight2_Die"), 
                 content.Load<SoundEffect>("Sons/UnitLight2/UnitLight2_Fire")
                 },
                 // UnitLight3
                 { 
                 content.Load<SoundEffect>("Sons/UnitLight3/UnitLight3_Popreal"), 
                 content.Load<SoundEffect>("Sons/UnitLight3/UnitLight3_Die"), 
                 content.Load<SoundEffect>("Sons/UnitLight3/UnitLight3_Fire")
                 },
                 // UnitMedium1
                 { 
                 content.Load<SoundEffect>("Sons/UnitMedium1/UnitMedium1_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitMedium1/UnitMedium1_Die"), 
                 content.Load<SoundEffect>("Sons/UnitMedium1/UnitMedium1_Fire")
                 },
                 // UnitMedium2
                 { 
                 content.Load<SoundEffect>("Sons/UnitMedium2/UnitMedium2_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitMedium2/UnitMedium2_Die"), 
                 content.Load<SoundEffect>("Sons/UnitMedium2/UnitMedium2_Fire")
                 },
                 // UnitMedium3
                 { 
                 content.Load<SoundEffect>("Sons/UnitMedium3/UnitMedium3_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitMedium3/UnitMedium3_Die"), 
                 content.Load<SoundEffect>("Sons/UnitMedium3/UnitMedium3_Fire")
                 },
                 // UnitHeavy1
                 { 
                 content.Load<SoundEffect>("Sons/UnitHeavy1/UnitHeavy1_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitHeavy1/UnitHeavy1_Die"), 
                 content.Load<SoundEffect>("Sons/UnitHeavy1/UnitHeavy1_Fire"),
                 },
                 // UnitHeavy2
                 {
                 content.Load<SoundEffect>("Sons/UnitHeavy2/UnitHeavy2_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitHeavy2/UnitHeavy2_Firea"), 
                 content.Load<SoundEffect>("Sons/UnitHeavy2/UnitHeavy2_Firea"),
                 },
                 // UnitHeavy3
                 { 
                 content.Load<SoundEffect>("Sons/UnitHeavy3/UnitHeavy3_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitHeavy3/UnitHeavy3_Die"), 
                 content.Load<SoundEffect>("Sons/UnitHeavy3/UnitHeavy3_Fire")
                 },
                 // FANTOOOME
                 { 
                 content.Load<SoundEffect>("Sons/UnitLight3/UnitLight3_Pop"), 
                 content.Load<SoundEffect>("Sons/UnitLight3/UnitLight3_Die"), 
                 content.Load<SoundEffect>("Sons/UnitLight3/UnitLight3_Fire")
                 },

            };

            cashSound = content.Load<SoundEffect>("Sons/Hud/cashSound");
            noCashSound = content.Load<SoundEffect>("Sons/Hud/noCashSound");
            baseUpSound = content.Load<SoundEffect>("Sons/Hud/baseUpSound");
            ButtonClick = content.Load<SoundEffect>("Sons/UI/ButtonClick");
            ButtonTouche = content.Load<SoundEffect>("Sons/UI/ButtonTouche");
            AchievLocked = content.Load<SoundEffect>("Sons/UI/achielock");
            Ting = content.Load<SoundEffect>("Sons/UI/hitsound");

            QuakeSounds = new SoundEffect[]
            {
            content.Load<SoundEffect>("Sons/Quake/dominating_male"),
            content.Load<SoundEffect>("Sons/Quake/rampage_male"),
            content.Load<SoundEffect>("Sons/Quake/monsterkill_male"),
            content.Load<SoundEffect>("Sons/Quake/godlike_male"),
            content.Load<SoundEffect>("Sons/Quake/holyshit_male"),
            content.Load<SoundEffect>("Sons/Quake/firstblood_male"),
            content.Load<SoundEffect>("Sons/Quake/fight_male"),
            content.Load<SoundEffect>("Sons/Quake/one_male"),
            content.Load<SoundEffect>("Sons/Quake/two_male"),
            content.Load<SoundEffect>("Sons/Quake/three_male"),
            content.Load<SoundEffect>("Sons/Quake/prepare_male"),
            content.Load<SoundEffect>("Sons/Quake/finishhim_male"),
            content.Load<SoundEffect>("Sons/Quake/draw_female"),
            content.Load<SoundEffect>("Sons/Quake/victory_female"),
            content.Load<SoundEffect>("Sons/Quake/failed_female"),
            content.Load<SoundEffect>("Sons/Quake/dominating_female"),
            content.Load<SoundEffect>("Sons/Quake/rampage_female"),
            content.Load<SoundEffect>("Sons/Quake/monsterkill_female"),
            content.Load<SoundEffect>("Sons/Quake/godlike_female"),
            content.Load<SoundEffect>("Sons/Quake/holyshit_female"),
            content.Load<SoundEffect>("Sons/Quake/firstblood_female"),
            content.Load<SoundEffect>("Sons/Quake/fight_female"),
            content.Load<SoundEffect>("Sons/Quake/one_female"),
            content.Load<SoundEffect>("Sons/Quake/two_female"),
            content.Load<SoundEffect>("Sons/Quake/three_female"),
            content.Load<SoundEffect>("Sons/Quake/prepare_female"),
            content.Load<SoundEffect>("Sons/Quake/finishhim_female"),
            content.Load<SoundEffect>("Sons/Quake/draw_female"),
            content.Load<SoundEffect>("Sons/Quake/victory_female"),
            content.Load<SoundEffect>("Sons/Quake/failed_female"),
            };

            //Pouvoirs
            SoundPouvoirs = new SoundEffect[]
            {
            content.Load<SoundEffect>("Sons/Pouv/Heal"),
            content.Load<SoundEffect>("Sons/Pouv/Beam"),
            content.Load<SoundEffect>("Sons/Pouv/Explosion"),
            content.Load<SoundEffect>("Sons/Pouv/bomblaunch"),
            };

            Explosions = new SoundEffect[]
            {
               content.Load<SoundEffect>("Sons/UnitHeavy2/UnitHeavy2_Firea"),
               content.Load<SoundEffect>("Sons/UnitHeavy2/UnitHeavy2_Fireb"),
               content.Load<SoundEffect>("Sons/UnitHeavy2/UnitHeavy2_Firec"),
            };
            Scream = content.Load<SoundEffect>("Sons/Hud/scream");
            //Ziks
            MenuMusic = content.Load<Song>("Sons/Musics/MenuMusic");
            LevelMusic = new Song[] 
            {
                 content.Load<Song>("Sons/Musics/VLVX_song18"), // hill
                content.Load<Song>("Sons/Musics/HL2_song2"), // hiver
                content.Load<Song>("Sons/Musics/Starcraft Terran theme"), // forest
                content.Load<Song>("Sons/Musics/VLVX_song23"), // desert
                content.Load<Song>("Sons/Musics/HL1_song14"), // temple
                content.Load<Song>("Sons/Musics/dolletlandingtheme"), // frontier
                content.Load<Song>("Sons/Musics/HL1_song15"), //City
            };
        }
    }
}
